package com.tdtxdcxm.ruralcommunity.myutils;

import com.tdtxdcxm.ruralcommunity.appruntime.DataCenterControl;
import com.tdtxdcxm.ruralcommunity.appruntime.UserConfigInfo;
import com.tdtxdcxm.ruralcommunity.httpmanagers.ThreadPoolUtil;
import com.tdtxdcxm.ruralcommunity.items.LCArryListContentItem;
import com.tdtxdcxm.ruralcommunity.items.LCArryListNormalItem;
import com.tdtxdcxm.ruralcommunity.providers.LCProviderForContent;
import com.tdtxdcxm.ruralcommunity.slice.*;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.aafwk.content.Operation;
import ohos.agp.components.*;
import ohos.agp.utils.LayoutAlignment;
import ohos.agp.window.dialog.CommonDialog;
import ohos.agp.window.dialog.IDialog;
import ohos.agp.window.dialog.ToastDialog;
import ohos.app.Context;
import ohos.net.NetHandle;
import ohos.net.NetManager;
import ohos.net.NetStatusCallback;
import ohos.utils.zson.ZSONObject;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

public class MyTools {
    private MyTools(){}

    /*<****************http构造表单上传注册数据区域*****************/
    public static void UpDataRegeisterInfo(AbilitySlice slice, String[][] userinfo, Text reg_tstext, TextField reg_usernametfd, TextField reg_passwordtfd, TextField reg_email, RadioContainer reg_dll2_1_radiocontainer,TextField reg_nl){
        NetManager main_toplistnetmanger = NetManager.getInstance(slice.getContext());
        if (!main_toplistnetmanger.hasDefaultNet()) {
            return;
        }
        ThreadPoolUtil.submit(() -> {
            NetHandle thenetHandle = main_toplistnetmanger.getDefaultNet();
            NetStatusCallback netStatusCallback = new NetStatusCallback() {};
            HttpURLConnection httpURLConnection = null;

            String urlString = DataCenterControl.serverIpWithPort + "register/?";
            try {
                URL url = new URL(urlString);

                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                URLConnection urlConnection = thenetHandle.openConnection(url, java.net.Proxy.NO_PROXY);
                if (urlConnection instanceof HttpURLConnection) {
                    httpURLConnection = (HttpURLConnection) urlConnection;

                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setDoOutput(true);

                    StringBuilder stringBuilder = new StringBuilder();

                    for(int i = 0;i < userinfo.length;i++){
                        if(i == 0){
                            stringBuilder.append(userinfo[0][0]);
                            stringBuilder.append("=");
                            stringBuilder.append(userinfo[0][1]);
                            continue;
                        }
                        stringBuilder.append("&");
                        stringBuilder.append(userinfo[i][0]);
                        stringBuilder.append("=");
                        stringBuilder.append(userinfo[i][1]);
                    }

                    byte[] b = stringBuilder.toString().getBytes();
                    httpURLConnection.getOutputStream().write(b);

                    try {
                        httpURLConnection.connect();
                    } catch (IOException e) {}
                    outputStream.flush();

                    try {
                        InputStream inputStream = urlConnection.getInputStream();
                        byte[] cache = new byte[2 * 1024];
                        int len = inputStream.read(cache);
                        while (len != -1) {
                            outputStream.write(cache, 0, len);
                            len = inputStream.read(cache);
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    String result = "";
                    result = new String(outputStream.toByteArray());
                    if(result.equals("OK")){
                        DataCenterControl.userName = userinfo[0][1];
                        DataCenterControl.gender = userinfo[3][1];
                        DataCenterControl.age = userinfo[4][1];
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                reg_tstext.setText("注册成功");
                                reg_usernametfd.setText("");
                                reg_passwordtfd.setText("");
                                reg_email.setText("");
                                reg_dll2_1_radiocontainer.cancelMarks();
                                reg_nl.setText("");

                                UserConfigInfo.pushData(slice.getContext(),userinfo);//将注册数据写入本地数据库
                                RegisterSlice.toanotherslice = true;
                            }
                        });
                        slice.present(new MainAbilitySlice(),new Intent());
                    }
                    else{
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                reg_tstext.setText("注册失败");
                            }
                        });
                    }
                }
            } catch (IOException e) {

            } finally {
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
        });
    }
    /******************http构造表单上传注册数据区域***************>*/

    /*<****************http构造表单上传注登录数据区域*****************/
    public static void UpDataLoginInfo(AbilitySlice slice,String[] userinfo,String[][] userinfodown,Text log_tstext,TextField log_usernametfd,TextField log_passwordtfd){
        NetManager main_toplistnetmanger = NetManager.getInstance(slice.getContext());
        if (!main_toplistnetmanger.hasDefaultNet()) {
            return;
        }
        ThreadPoolUtil.submit(() -> {
            NetHandle thenetHandle = main_toplistnetmanger.getDefaultNet();
            NetStatusCallback netStatusCallback = new NetStatusCallback() {};
            HttpURLConnection httpURLConnection = null;

            String urlString = DataCenterControl.serverIpWithPort + "login/?";
            try {
                URL url = new URL(urlString);

                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                URLConnection urlConnection = thenetHandle.openConnection(url, java.net.Proxy.NO_PROXY);
                if (urlConnection instanceof HttpURLConnection) {
                    httpURLConnection = (HttpURLConnection) urlConnection;

                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setDoOutput(true);

                    StringBuilder stringBuilder = new StringBuilder();

                    stringBuilder.append("username");
                    stringBuilder.append("=");
                    stringBuilder.append(userinfo[0]);
                    stringBuilder.append("&");
                    stringBuilder.append("password");
                    stringBuilder.append("=");
                    stringBuilder.append(userinfo[1]);


                    byte[] b = stringBuilder.toString().getBytes();
                    httpURLConnection.getOutputStream().write(b);

                    try {
                        httpURLConnection.connect();
                    } catch (IOException e) {}
                    outputStream.flush();

                    try {
                        InputStream inputStream = urlConnection.getInputStream();
                        byte[] cache = new byte[2 * 1024];
                        int len = inputStream.read(cache);
                        while (len != -1) {
                            outputStream.write(cache, 0, len);
                            len = inputStream.read(cache);
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    String result = "";
                    result = new String(outputStream.toByteArray());


                    String[] userinfos = result.split(",");

                    if(userinfos[0].equals("OK")){
                        userinfodown[0][0] = "username";
                        userinfodown[0][1] = userinfos[1];

                        userinfodown[1][0] = "password";
                        userinfodown[1][1] = userinfos[2];

                        userinfodown[2][0] = "email";
                        userinfodown[2][1] = userinfos[3];

                        userinfodown[3][0] = "gender";
                        userinfodown[3][1] = userinfos[4];

                        userinfodown[4][0] = "age";
                        userinfodown[4][1] = userinfos[5];

                        UserConfigInfo.pushData(slice.getContext(),userinfodown);
                        DataCenterControl.userName = userinfo[0];
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                log_tstext.setText("登录成功");
                                log_usernametfd.setText("");
                                log_passwordtfd.setText("");

                                DataCenterControl.age = userinfos[5];
                                DataCenterControl.gender = userinfos[4];

                                LoginSlice.toanotherslice = true;
                            }
                        });
                        slice.present(new MainAbilitySlice(),new Intent());
                    }
                    else{
                        if(userinfos[0].equals("NOT")){
                            slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                                @Override
                                public void run() {
                                    log_tstext.setText("远程验证：账号未注册！");
                                }
                            });
                        }
                        if(userinfos[0].equals("NO")){
                            slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                                @Override
                                public void run() {
                                    log_tstext.setText("远程验证：密码错误！");
                                }
                            });
                        }
                    }
                }
            } catch (IOException e) {}
            finally {
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
        });
    }
    /******************http构造表单上传登录数据区域***************>*/

    /*<****************http构造表单上传销毁指令数据区域*****************/
    public static void UpDataDestoryInfo(AbilitySlice slice,String username){
        NetManager main_toplistnetmanger = NetManager.getInstance(slice.getContext());
        if (!main_toplistnetmanger.hasDefaultNet()) {return;}
        ThreadPoolUtil.submit(() -> {
            NetHandle thenetHandle = main_toplistnetmanger.getDefaultNet();
            NetStatusCallback netStatusCallback = new NetStatusCallback() {};
            HttpURLConnection httpURLConnection = null;

            String urlString = DataCenterControl.serverIpWithPort + "destory/?";
            try {
                URL url = new URL(urlString);

                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                URLConnection urlConnection = thenetHandle.openConnection(url, java.net.Proxy.NO_PROXY);
                if (urlConnection instanceof HttpURLConnection) {
                    httpURLConnection = (HttpURLConnection) urlConnection;

                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setDoOutput(true);

                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append("username");
                    stringBuilder.append("=");
                    stringBuilder.append(username);

                    byte[] b = stringBuilder.toString().getBytes();
                    httpURLConnection.getOutputStream().write(b);

                    try {
                        httpURLConnection.connect();
                    } catch (IOException e) {}
                    outputStream.flush();

                    InputStream inputStream = null;
                    try {
                        inputStream = urlConnection.getInputStream();
                        byte[] cache = new byte[2 * 1024];
                        int len = inputStream.read(cache);
                        while (len != -1) {
                            outputStream.write(cache, 0, len);
                            len = inputStream.read(cache);
                        }
                    } catch (IOException e) {}
                    String result = "";
                    result = outputStream.toString();
                    if(result.equals("OK")){
                        //销毁成功
                        UserConfigInfo.deleteUserInfo(slice.getContext(),DataCenterControl.userName);
                        DataCenterControl.userName = "";
                        ((MainAbilitySlice)slice).toanotherslice = true;
                        slice.present(new StartPage(),new Intent());
                    }
                    else{
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                MyTools.toastShow("销毁失败", slice.getContext());
                            }
                        });

                    }
                }
            } catch (IOException e) {} finally {
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
        });
    }
    /******************http构造表单上传销毁指令数据区域***************>*/

    /*<****************http搜索用户数据区域*****************/
    public static void UpDataSearchUserInfo(AbilitySlice slice, String username,String objectname){
        NetManager main_toplistnetmanger = NetManager.getInstance(slice.getContext());
        if (!main_toplistnetmanger.hasDefaultNet()) {
            return;
        }
        ThreadPoolUtil.submit(() -> {
            NetHandle thenetHandle = main_toplistnetmanger.getDefaultNet();
            NetStatusCallback netStatusCallback = new NetStatusCallback() {};
            HttpURLConnection httpURLConnection = null;

            String urlString = DataCenterControl.serverIpWithPort + "searchuser/?";
            try {
                URL url = new URL(urlString);

                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                URLConnection urlConnection = thenetHandle.openConnection(url, java.net.Proxy.NO_PROXY);
                if (urlConnection instanceof HttpURLConnection) {
                    httpURLConnection = (HttpURLConnection) urlConnection;

                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setDoOutput(true);

                    StringBuilder stringBuilder = new StringBuilder();

                    stringBuilder.append("username=");
                    stringBuilder.append(username);
                    stringBuilder.append("&objectname=");
                    stringBuilder.append(objectname);


                    byte[] b = stringBuilder.toString().getBytes();
                    httpURLConnection.getOutputStream().write(b);

                    try {
                        httpURLConnection.connect();
                    } catch (IOException e) {}
                    outputStream.flush();

                    InputStream inputStream = null;
                    try {
                        inputStream = urlConnection.getInputStream();
                        byte[] cache = new byte[2 * 1024];
                        int len = inputStream.read(cache);
                        while (len != -1) {
                            outputStream.write(cache, 0, len);
                            len = inputStream.read(cache);
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    String result = "";
                    result = outputStream.toString();
                    if(result.startsWith("OK")){
                        //搜索成功
                        String finalResult = result;
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                DataCenterControl.people_listcontainer_list.clear();
                                DataCenterControl.people_listcontainer_list.add(new LCArryListNormalItem(finalResult.substring(3)));
                                if(DataCenterControl.peopleListContainerProvider != null){
                                    DataCenterControl.peopleListContainerProvider.notifyDataChanged();
                                }
                            }
                        });
                    }
                    else{
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                MyTools.toastShow("搜索为空！", slice.getContext());
                            }
                        });

                    }
                }
            } catch (IOException e) {

            } finally {
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
        });
    }
    /******************http搜索用户数据区域***************>*/

    /*<****************http请求全站内容列表数据区域*****************/
    public static void DownDataWorldListInfo(AbilitySlice slice,String type,String field){
        NetManager main_toplistnetmanger = NetManager.getInstance(slice.getContext());
        if (!main_toplistnetmanger.hasDefaultNet()) {return;}
        ThreadPoolUtil.submit(() -> {
            NetHandle thenetHandle = main_toplistnetmanger.getDefaultNet();
            NetStatusCallback netStatusCallback = new NetStatusCallback() {};
            HttpURLConnection httpURLConnection = null;
            String urlString = null;

            switch(type){
                case "worlddt":
                    urlString = DataCenterControl.serverIpWithPort + "worlddt/";
                    break;
                case "worldxm":
                    urlString = DataCenterControl.serverIpWithPort + "worldxm/";
                    break;
                case "worldwz":
                    urlString = DataCenterControl.serverIpWithPort + "worldwz/";
                    break;
                case "worldfield":
                    urlString = DataCenterControl.serverIpWithPort + "worldfield/";
                    break;
                default:
                    urlString = DataCenterControl.serverIpWithPort + "index/";
                    break;
            }

            try {
                URL url = new URL(urlString);
                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                URLConnection urlConnection = thenetHandle.openConnection(url, java.net.Proxy.NO_PROXY);
                if (urlConnection instanceof HttpURLConnection) {
                    httpURLConnection = (HttpURLConnection) urlConnection;
                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setDoOutput(true);

                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append("field_id=");
                    switch (field){
                        case "art":
                            stringBuilder.append("1");
                            break;
                        case "clothe":
                            stringBuilder.append("2");
                            break;
                        case "food":
                            stringBuilder.append("3");
                            break;
                        case "house":
                            stringBuilder.append("4");
                            break;
                        case "traffic":
                            stringBuilder.append("5");
                            break;
                        case "study":
                            stringBuilder.append("6");
                            break;
                        case "culture":
                            stringBuilder.append("7");
                            break;
                        default:
                            stringBuilder.append("0");
                            break;
                    }
                    byte[] b = stringBuilder.toString().getBytes();
                    httpURLConnection.getOutputStream().write(b);

                    try {
                        httpURLConnection.connect();
                    } catch (IOException e) {}
                    outputStream.flush();

                    InputStream inputStream = null;
                    try {
                        inputStream = urlConnection.getInputStream();
                        byte[] cache = new byte[2 * 1024];
                        int len = inputStream.read(cache);
                        while (len != -1) {
                            outputStream.write(cache, 0, len);
                            len = inputStream.read(cache);
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    String result = "";
                    result = outputStream.toString();
                    if(result.indexOf("sum") != -1){
                        //请求全站动态成功
                        String finalResult = result;
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                switch (type) {
                                    case "worlddt":
                                        ZSONObject zsonobject_dt = ZSONObject.stringToZSON(finalResult);
                                        int sum_dt = Integer.parseInt(zsonobject_dt.getString("sum"));
                                        DataCenterControl.worlddt_listcontainer_list.clear();
                                        for(int i = 0;i < sum_dt;i++){
                                            ZSONObject t = ZSONObject.stringToZSON(zsonobject_dt.getString(String.valueOf(i)));

                                            int detail_len = t.getString("DETAIL").length();
                                            DataCenterControl.worlddt_listcontainer_list.add(
                                                    new LCArryListContentItem(t.getString("CONTENT_ID")
                                                            ,t.getString("TYPE")
                                                            ,t.getString("DATE")
                                                            ,t.getString("READVALUE")
                                                            ,t.getString("DETAIL").substring(12,detail_len - 1 - 1).replace("\\n","\n")
                                                            ,t.getString("USER_ID")
                                                            ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                    )
                                            );
                                        }
                                        if(DataCenterControl.worldDtListContainerProvider != null){
                                            DataCenterControl.worldDtListContainerProvider.notifyDataChanged();
                                        }
                                        MyTools.toastShow("全站动态下载成功！", slice.getContext());
                                        break;
                                    case "worldxm":
                                        ZSONObject zsonobject_xm = ZSONObject.stringToZSON(finalResult);
                                        int sum_xm = Integer.parseInt(zsonobject_xm.getString("sum"));
                                        DataCenterControl.worldxm_listcontainer_list.clear();
                                        for(int i = 0;i < sum_xm;i++){
                                            ZSONObject t = ZSONObject.stringToZSON(zsonobject_xm.getString(String.valueOf(i)));

                                            int detail_len = t.getString("DETAIL").length();
                                            DataCenterControl.worldxm_listcontainer_list.add(
                                                    new LCArryListContentItem(t.getString("CONTENT_ID")
                                                            ,t.getString("TYPE")
                                                            ,t.getString("DATE")
                                                            ,t.getString("READVALUE")
                                                            ,t.getString("DETAIL")
                                                            ,t.getString("USER_ID")
                                                            ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                    )
                                            );
                                        }
                                        if(DataCenterControl.worldXmListContainerProvider != null){
                                            DataCenterControl.worldXmListContainerProvider.notifyDataChanged();
                                        }
                                        MyTools.toastShow("全站项目下载成功！", slice.getContext());
                                        break;
                                    case "worldwz":
                                        ZSONObject zsonobject_wz = ZSONObject.stringToZSON(finalResult);
                                        int sum_wz = Integer.parseInt(zsonobject_wz.getString("sum"));
                                        DataCenterControl.worldwz_listcontainer_list.clear();
                                        for(int i = 0;i < sum_wz;i++){
                                            ZSONObject t = ZSONObject.stringToZSON(zsonobject_wz.getString(String.valueOf(i)));

                                            int detail_len = t.getString("DETAIL").length();
                                            DataCenterControl.worldwz_listcontainer_list.add(
                                                    new LCArryListContentItem(t.getString("CONTENT_ID")
                                                            ,t.getString("TYPE")
                                                            ,t.getString("DATE")
                                                            ,t.getString("READVALUE")
                                                            ,t.getString("DETAIL").substring(12,detail_len - 1 - 1).replace("\\n","\n")
                                                            ,t.getString("USER_ID")
                                                            ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                    )
                                            );
                                        }
                                        if(DataCenterControl.worldWzListContainerProvider != null){
                                            DataCenterControl.worldWzListContainerProvider.notifyDataChanged();
                                        }
                                        MyTools.toastShow("全站文章下载成功！", slice.getContext());
                                        break;
                                    case "worldfield":
                                        switch (field){
                                            case "art":
                                                ZSONObject zsonobject_art = ZSONObject.stringToZSON(finalResult);
                                                int sum_art = Integer.parseInt(zsonobject_art.getString("sum"));
                                                DataCenterControl.art_listcontainer_list.clear();
                                                for(int i = 0;i < sum_art;i++){
                                                    ZSONObject t = ZSONObject.stringToZSON(zsonobject_art.getString(String.valueOf(i)));
                                                    String field = t.getString("TYPE");
                                                    int detail_len = t.getString("DETAIL").length();
                                                    if(field.equals("动态") || field.equals("文章")){
                                                        DataCenterControl.art_listcontainer_list.add(
                                                                new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                        ,t.getString("TYPE")
                                                                        ,t.getString("DATE")
                                                                        ,t.getString("READVALUE")
                                                                        ,t.getString("DETAIL").substring(12,detail_len - 1 - 1).replace("\\n","\n")
                                                                        ,t.getString("USER_ID")
                                                                        ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                                )
                                                        );
                                                    }
                                                    if(field.equals("项目")){
                                                        DataCenterControl.art_listcontainer_list.add(
                                                                new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                        ,t.getString("TYPE")
                                                                        ,t.getString("DATE")
                                                                        ,t.getString("READVALUE")
                                                                        ,t.getString("DETAIL")
                                                                        ,t.getString("USER_ID")
                                                                        ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                                )
                                                        );
                                                    }
                                                }
                                                if(DataCenterControl.artListContainerProvider != null){
                                                    DataCenterControl.artListContainerProvider.notifyDataChanged();
                                                }
                                                MyTools.toastShow("[艺]下载成功！", slice.getContext());
                                                break;
                                            case "clothe":
                                                ZSONObject zsonobject_clothe = ZSONObject.stringToZSON(finalResult);
                                                int sum_clothe = Integer.parseInt(zsonobject_clothe.getString("sum"));
                                                DataCenterControl.clothe_listcontainer_list.clear();
                                                for(int i = 0;i < sum_clothe;i++){
                                                    ZSONObject t = ZSONObject.stringToZSON(zsonobject_clothe.getString(String.valueOf(i)));
                                                    String field = t.getString("TYPE");
                                                    int detail_len = t.getString("DETAIL").length();
                                                    if(field.equals("动态") || field.equals("文章")){
                                                        DataCenterControl.clothe_listcontainer_list.add(
                                                                new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                        ,t.getString("TYPE")
                                                                        ,t.getString("DATE")
                                                                        ,t.getString("READVALUE")
                                                                        ,t.getString("DETAIL").substring(12,detail_len - 1 - 1).replace("\\n","\n")
                                                                        ,t.getString("USER_ID")
                                                                        ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                                )
                                                        );
                                                    }
                                                    if(field.equals("项目")){
                                                        DataCenterControl.clothe_listcontainer_list.add(
                                                                new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                        ,t.getString("TYPE")
                                                                        ,t.getString("DATE")
                                                                        ,t.getString("READVALUE")
                                                                        ,t.getString("DETAIL")
                                                                        ,t.getString("USER_ID")
                                                                        ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                                )
                                                        );
                                                    }
                                                }
                                                if(DataCenterControl.clotheListContainerProvider != null){
                                                    DataCenterControl.clotheListContainerProvider.notifyDataChanged();
                                                }
                                                MyTools.toastShow("[衣]下载成功！", slice.getContext());
                                                break;
                                            case "food":
                                                ZSONObject zsonobject_food = ZSONObject.stringToZSON(finalResult);
                                                int sum_food = Integer.parseInt(zsonobject_food.getString("sum"));
                                                DataCenterControl.food_listcontainer_list.clear();
                                                for(int i = 0;i < sum_food;i++){
                                                    ZSONObject t = ZSONObject.stringToZSON(zsonobject_food.getString(String.valueOf(i)));
                                                    String field = t.getString("TYPE");
                                                    int detail_len = t.getString("DETAIL").length();
                                                    if(field.equals("动态") || field.equals("文章")){
                                                        DataCenterControl.food_listcontainer_list.add(
                                                                new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                        ,t.getString("TYPE")
                                                                        ,t.getString("DATE")
                                                                        ,t.getString("READVALUE")
                                                                        ,t.getString("DETAIL").substring(12,detail_len - 1 - 1).replace("\\n","\n")
                                                                        ,t.getString("USER_ID")
                                                                        ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                                )
                                                        );
                                                    }
                                                    if(field.equals("项目")){
                                                        DataCenterControl.food_listcontainer_list.add(
                                                                new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                        ,t.getString("TYPE")
                                                                        ,t.getString("DATE")
                                                                        ,t.getString("READVALUE")
                                                                        ,t.getString("DETAIL")
                                                                        ,t.getString("USER_ID")
                                                                        ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                                )
                                                        );
                                                    }
                                                }
                                                if(DataCenterControl.foodListContainerProvider != null){
                                                    DataCenterControl.foodListContainerProvider.notifyDataChanged();
                                                }
                                                MyTools.toastShow("[食]下载成功！", slice.getContext());
                                                break;
                                            case "house":
                                                ZSONObject zsonobject_house = ZSONObject.stringToZSON(finalResult);
                                                int sum_house = Integer.parseInt(zsonobject_house.getString("sum"));
                                                DataCenterControl.house_listcontainer_list.clear();
                                                for(int i = 0;i < sum_house;i++){
                                                    ZSONObject t = ZSONObject.stringToZSON(zsonobject_house.getString(String.valueOf(i)));
                                                    String field = t.getString("TYPE");
                                                    int detail_len = t.getString("DETAIL").length();
                                                    if(field.equals("动态") || field.equals("文章")){
                                                        DataCenterControl.house_listcontainer_list.add(
                                                                new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                        ,t.getString("TYPE")
                                                                        ,t.getString("DATE")
                                                                        ,t.getString("READVALUE")
                                                                        ,t.getString("DETAIL").substring(12,detail_len - 1 - 1).replace("\\n","\n")
                                                                        ,t.getString("USER_ID")
                                                                        ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                                )
                                                        );
                                                    }
                                                    if(field.equals("项目")){
                                                        DataCenterControl.house_listcontainer_list.add(
                                                                new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                        ,t.getString("TYPE")
                                                                        ,t.getString("DATE")
                                                                        ,t.getString("READVALUE")
                                                                        ,t.getString("DETAIL")
                                                                        ,t.getString("USER_ID")
                                                                        ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                                )
                                                        );
                                                    }
                                                }
                                                if(DataCenterControl.houseListContainerProvider != null){
                                                    DataCenterControl.houseListContainerProvider.notifyDataChanged();
                                                }
                                                MyTools.toastShow("[住]下载成功！", slice.getContext());
                                                break;
                                            case "traffic":
                                                ZSONObject zsonobject_traffic = ZSONObject.stringToZSON(finalResult);
                                                int sum_traffic = Integer.parseInt(zsonobject_traffic.getString("sum"));
                                                DataCenterControl.traffic_listcontainer_list.clear();
                                                for(int i = 0;i < sum_traffic;i++){
                                                    ZSONObject t = ZSONObject.stringToZSON(zsonobject_traffic.getString(String.valueOf(i)));
                                                    String field = t.getString("TYPE");
                                                    int detail_len = t.getString("DETAIL").length();
                                                    if(field.equals("动态") || field.equals("文章")){
                                                        DataCenterControl.traffic_listcontainer_list.add(
                                                                new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                        ,t.getString("TYPE")
                                                                        ,t.getString("DATE")
                                                                        ,t.getString("READVALUE")
                                                                        ,t.getString("DETAIL").substring(12,detail_len - 1 - 1).replace("\\n","\n")
                                                                        ,t.getString("USER_ID")
                                                                        ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                                )
                                                        );
                                                    }
                                                    if(field.equals("项目")){
                                                        DataCenterControl.traffic_listcontainer_list.add(
                                                                new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                        ,t.getString("TYPE")
                                                                        ,t.getString("DATE")
                                                                        ,t.getString("READVALUE")
                                                                        ,t.getString("DETAIL")
                                                                        ,t.getString("USER_ID")
                                                                        ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                                )
                                                        );
                                                    }
                                                }
                                                if(DataCenterControl.trafficListContainerProvider != null){
                                                    DataCenterControl.trafficListContainerProvider.notifyDataChanged();
                                                }
                                                MyTools.toastShow("[行]下载成功！", slice.getContext());
                                                break;
                                            case "study":
                                                ZSONObject zsonobject_study = ZSONObject.stringToZSON(finalResult);
                                                int sum_study = Integer.parseInt(zsonobject_study.getString("sum"));
                                                DataCenterControl.study_listcontainer_list.clear();
                                                for(int i = 0;i < sum_study;i++){
                                                    ZSONObject t = ZSONObject.stringToZSON(zsonobject_study.getString(String.valueOf(i)));
                                                    String field = t.getString("TYPE");
                                                    int detail_len = t.getString("DETAIL").length();
                                                    if(field.equals("动态") || field.equals("文章")){
                                                        DataCenterControl.study_listcontainer_list.add(
                                                                new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                        ,t.getString("TYPE")
                                                                        ,t.getString("DATE")
                                                                        ,t.getString("READVALUE")
                                                                        ,t.getString("DETAIL").substring(12,detail_len - 1 - 1).replace("\\n","\n")
                                                                        ,t.getString("USER_ID")
                                                                        ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                                )
                                                        );
                                                    }
                                                    if(field.equals("项目")){
                                                        DataCenterControl.study_listcontainer_list.add(
                                                                new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                        ,t.getString("TYPE")
                                                                        ,t.getString("DATE")
                                                                        ,t.getString("READVALUE")
                                                                        ,t.getString("DETAIL")
                                                                        ,t.getString("USER_ID")
                                                                        ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                                )
                                                        );
                                                    }
                                                }
                                                if(DataCenterControl.studyListContainerProvider != null){
                                                    DataCenterControl.studyListContainerProvider.notifyDataChanged();
                                                }
                                                MyTools.toastShow("[学]下载成功！", slice.getContext());
                                                break;
                                            case "culture":
                                                ZSONObject zsonobject_culture = ZSONObject.stringToZSON(finalResult);
                                                int sum_culture = Integer.parseInt(zsonobject_culture.getString("sum"));
                                                DataCenterControl.culture_listcontainer_list.clear();
                                                for(int i = 0;i < sum_culture;i++){
                                                    ZSONObject t = ZSONObject.stringToZSON(zsonobject_culture.getString(String.valueOf(i)));
                                                    String field = t.getString("TYPE");
                                                    int detail_len = t.getString("DETAIL").length();
                                                    if(field.equals("动态") || field.equals("文章")){
                                                        DataCenterControl.culture_listcontainer_list.add(
                                                                new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                        ,t.getString("TYPE")
                                                                        ,t.getString("DATE")
                                                                        ,t.getString("READVALUE")
                                                                        ,t.getString("DETAIL").substring(12,detail_len - 1 - 1).replace("\\n","\n")
                                                                        ,t.getString("USER_ID")
                                                                        ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                                )
                                                        );
                                                    }
                                                    if(field.equals("项目")){
                                                        DataCenterControl.culture_listcontainer_list.add(
                                                                new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                        ,t.getString("TYPE")
                                                                        ,t.getString("DATE")
                                                                        ,t.getString("READVALUE")
                                                                        ,t.getString("DETAIL")
                                                                        ,t.getString("USER_ID")
                                                                        ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                                )
                                                        );
                                                    }
                                                }
                                                if(DataCenterControl.cultureListContainerProvider != null){
                                                    DataCenterControl.cultureListContainerProvider.notifyDataChanged();
                                                }
                                                MyTools.toastShow("[文]下载成功！", slice.getContext());
                                                break;
                                            default:
                                                break;
                                        }
                                        break;
                                    default:
                                        MyTools.toastShow("全站未知下载成功！", slice.getContext());
                                        break;
                                }
                            }
                        });
                    }
                    else if(result.equals("NULL")){
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                MyTools.toastShow("全站内容为空！", slice.getContext());
                            }
                        });
                    }
                    else{
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                switch (type) {
                                    case "worlddt":
                                        MyTools.toastShow("全站动态下载失败！", slice.getContext());
                                        break;
                                    case "worldxm":
                                        MyTools.toastShow("全站项目下载失败！", slice.getContext());
                                        break;
                                    case "worldwz":
                                        MyTools.toastShow("全站文章下载失败！", slice.getContext());
                                        break;
                                    default:
                                        MyTools.toastShow("全站未知下载失败！", slice.getContext());
                                        break;
                                }
                            }
                        });
                    }
                }
            } catch (IOException e) {} finally {
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
        });
    }
    /******************http请求全站内容列表数据区域***************>*/

    /*<****************http请求用户点赞、评论、收藏消息数据区域*****************/
    public static void DownDataMessageListInfo(AbilitySlice slice,String type){
        NetManager main_toplistnetmanger = NetManager.getInstance(slice.getContext());
        if (!main_toplistnetmanger.hasDefaultNet()) {
            return;
        }
        ThreadPoolUtil.submit(() -> {
            NetHandle thenetHandle = main_toplistnetmanger.getDefaultNet();
            NetStatusCallback netStatusCallback = new NetStatusCallback() {};
            HttpURLConnection httpURLConnection = null;

            String urlString = DataCenterControl.serverIpWithPort + "message/?";

            try {
                URL url = new URL(urlString);
                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                URLConnection urlConnection = thenetHandle.openConnection(url, java.net.Proxy.NO_PROXY);
                if (urlConnection instanceof HttpURLConnection) {
                    httpURLConnection = (HttpURLConnection) urlConnection;
                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setDoOutput(true);

                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append("username=");
                    stringBuilder.append(DataCenterControl.userName);
                    stringBuilder.append("&messagetype=");
                    switch(type){
                        case "messageagree":
                            stringBuilder.append("AGREE");
                            break;
                        case "messagediscuss":
                            stringBuilder.append("DISCUSS");
                            break;
                        case "messagecollect":
                            stringBuilder.append("COLLECT");
                            break;
                        default:
                            break;
                    }

                    byte[] b = stringBuilder.toString().getBytes();
                    httpURLConnection.getOutputStream().write(b);

                    try {
                        httpURLConnection.connect();
                    } catch (IOException e) {}
                    outputStream.flush();

                    InputStream inputStream = null;
                    try {
                        inputStream = urlConnection.getInputStream();
                        byte[] cache = new byte[2 * 1024];
                        int len = inputStream.read(cache);
                        while (len != -1) {
                            outputStream.write(cache, 0, len);
                            len = inputStream.read(cache);
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    String result = "";
                    result = outputStream.toString();
                    if(result.indexOf("sum") != -1){
                        String finalResult = result;
                        switch (type) {
                            case "messageagree":
                                ZSONObject zsonobject_agree = ZSONObject.stringToZSON(finalResult);
                                int sum_agree = Integer.parseInt(zsonobject_agree.getString("sum"));
                                DataCenterControl.messageagree_listcontainer_list.clear();
                                for(int i = 0;i < sum_agree;i++){
                                    String info = zsonobject_agree.getString(String.valueOf(i));
                                    DataCenterControl.messageagree_listcontainer_list.add(new LCArryListNormalItem(info));
                                }
                                break;
                            case "messagediscuss":
                                ZSONObject zsonobject_discuss = ZSONObject.stringToZSON(finalResult);
                                int sum_discuss = Integer.parseInt(zsonobject_discuss.getString("sum"));
                                DataCenterControl.messagediscuss_listcontainer_list.clear();
                                for(int i = 0;i < sum_discuss;i++){
                                    String info = zsonobject_discuss.getString(String.valueOf(i));
                                    DataCenterControl.messagediscuss_listcontainer_list.add(new LCArryListNormalItem(info));
                                }
                                break;
                            case "messagecollect":
                                ZSONObject zsonobject_collect = ZSONObject.stringToZSON(finalResult);
                                int sum_collect = Integer.parseInt(zsonobject_collect.getString("sum"));
                                DataCenterControl.messagecollect_listcontainer_list.clear();
                                for(int i = 0;i < sum_collect;i++){
                                    String info = zsonobject_collect.getString(String.valueOf(i));
                                    DataCenterControl.messagecollect_listcontainer_list.add(new LCArryListNormalItem(info));
                                }
                                break;
                            default:
                                break;
                        }
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                switch (type) {
                                    case "messageagree":
                                        if(DataCenterControl.messageAgreeListContainerProvider != null){
                                            DataCenterControl.messageAgreeListContainerProvider.notifyDataChanged();
                                        }
                                        MyTools.toastShow("用户点赞消息下载成功！", slice.getContext());
                                        break;
                                    case "messagediscuss":
                                        if(DataCenterControl.messageDiscussListContainerProvider != null){
                                            DataCenterControl.messageDiscussListContainerProvider.notifyDataChanged();
                                        }
                                        MyTools.toastShow("用户评论消息下载成功！", slice.getContext());
                                        break;
                                    case "messagecollect":
                                        if(DataCenterControl.messageCollectListContainerProvider != null){
                                            DataCenterControl.messageCollectListContainerProvider.notifyDataChanged();
                                        }
                                        MyTools.toastShow("用户收藏消息下载成功！", slice.getContext());
                                        break;
                                    default:
                                        MyTools.toastShow("全站未知下载成功！",slice.getContext());
                                        break;
                                }
                            }
                        });
                    }
                    else if(result.equals("NULL")){
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                switch (type) {
                                    case "messageagree":
                                        DataCenterControl.messageagree_listcontainer_list.clear();
                                        if(DataCenterControl.messageAgreeListContainerProvider != null){
                                            DataCenterControl.messageAgreeListContainerProvider.notifyDataChanged();
                                        }
                                        break;
                                    case "messagediscuss":
                                        DataCenterControl.messagediscuss_listcontainer_list.clear();
                                        if(DataCenterControl.messageDiscussListContainerProvider != null){
                                            DataCenterControl.messageDiscussListContainerProvider.notifyDataChanged();
                                        }
                                        break;
                                    case "messagecollect":
                                        DataCenterControl.messagecollect_listcontainer_list.clear();
                                        if(DataCenterControl.messageCollectListContainerProvider != null){
                                            DataCenterControl.messageCollectListContainerProvider.notifyDataChanged();
                                        }
                                        break;
                                }
                                MyTools.toastShow("用户消息为空！", slice.getContext());
                            }
                        });
                    }
                    else{
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                switch (type) {
                                    case "messageagree":
                                        MyTools.toastShow("用户点赞消息下载失败！", slice.getContext());
                                        break;
                                    case "messagediscuss":
                                        MyTools.toastShow("用户评论消息下载失败！", slice.getContext());
                                        break;
                                    case "messagecollect":
                                        MyTools.toastShow("用户收藏下载失败！", slice.getContext());
                                        break;
                                    default:
                                        MyTools.toastShow("用户未知消息下载失败！", slice.getContext());
                                        break;
                                }
                            }
                        });
                    }
                }
            } catch (IOException e) {}
            finally {
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
        });
    }
    /******************http请求用户点赞、评论、收藏消息数据区域***************>*/

    /*<****************http发送关注或取消关注指令区域*****************/
    public static void UpDataFollowInfo(AbilitySlice slice, Component component, String user_id, int i, String operation){
        NetManager main_toplistnetmanger = NetManager.getInstance(slice.getContext());
        if (!main_toplistnetmanger.hasDefaultNet()) {
            return;
        }
        ThreadPoolUtil.submit(() -> {
            NetHandle thenetHandle = main_toplistnetmanger.getDefaultNet();
            NetStatusCallback netStatusCallback = new NetStatusCallback() {};
            HttpURLConnection httpURLConnection = null;
            String urlString = "";
            if(operation.equals("关注")){

                urlString = DataCenterControl.serverIpWithPort + "follow/?";
            }
            if(operation.equals("取消关注")){

                urlString = DataCenterControl.serverIpWithPort + "unfollow/?";
            }

            try {
                URL url = new URL(urlString);
                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                URLConnection urlConnection = thenetHandle.openConnection(url, java.net.Proxy.NO_PROXY);
                if (urlConnection instanceof HttpURLConnection) {
                    httpURLConnection = (HttpURLConnection) urlConnection;
                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setDoOutput(true);

                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append("username=");
                    stringBuilder.append(DataCenterControl.userName);
                    stringBuilder.append("&user_id=");
                    stringBuilder.append(user_id);

                    byte[] b = stringBuilder.toString().getBytes();
                    httpURLConnection.getOutputStream().write(b);
                    try {
                        httpURLConnection.connect();
                    } catch (IOException e) {}
                    outputStream.flush();

                    InputStream inputStream = null;
                    try {
                        inputStream = urlConnection.getInputStream();
                        byte[] cache = new byte[2 * 1024];
                        int len = inputStream.read(cache);
                        while (len != -1) {
                            outputStream.write(cache, 0, len);
                            len = inputStream.read(cache);
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    String result = "";
                    result = outputStream.toString();

                    String[] tosettext = {"","",""};
                    if(result.equals("OK")){
                        if(operation.equals("关注")){
                            slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                                @Override
                                public void run() {
                                    //i是-1是代表是搜索用户结果列表的中操作,i是-2是代表内容详情页中的操作
                                    if(i == -1){
                                        DataCenterControl.people_listcontainer_list.get(0).setContent(user_id+"[已关注]");
                                        DataCenterControl.peopleListContainerProvider.notifyDataChanged();
                                    }
                                    else if(i == -2){
                                        ((Text)component).setText("已关注");
                                    }
                                    MyTools.toastShow("已关注",slice.getContext());
                                }
                            });
                        }
                        if(operation.equals("取消关注")){
                            slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                                @Override
                                public void run() {
                                    //i是-1是代表是搜索用户结果列表的中操作,i是-2是代表内容详情页中的操作，其余i是大于等于0是代表用户关注列表中的操作
                                    if(i == -1){
                                        DataCenterControl.people_listcontainer_list.remove(0);
                                        DataCenterControl.peopleListContainerProvider.notifyDataChanged();
                                    }
                                    else if(i == -2){
                                        ((Text)component).setText("关注");
                                    }
                                    else{
                                        DataCenterControl.follow_listcontainer_list.remove(i);
                                        DataCenterControl.followAndFanaListListContainerProvider.notifyDataChanged();
                                    }
                                    MyTools.toastShow("已取消关注",slice.getContext());
                                }
                            });
                        }
                    }
                }
            } catch (IOException e) {

            } finally {
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
        });
    }
    /******************http发送关注或取消关注指令区域***************>*/

    /*<****************htt请求关注数目、粉丝数目、阅读数目数据区域*****************/
    public static void DownDataFollowFansReadvalueInfo(AbilitySlice slice,String username,Text[] followfansread){
        NetManager main_toplistnetmanger = NetManager.getInstance(slice.getContext());
        if (!main_toplistnetmanger.hasDefaultNet()) {return;}
        ThreadPoolUtil.submit(() -> {
            NetHandle thenetHandle = main_toplistnetmanger.getDefaultNet();
            NetStatusCallback netStatusCallback = new NetStatusCallback() {};
            HttpURLConnection httpURLConnection = null;

            String urlString = DataCenterControl.serverIpWithPort + "count/?";
            try {
                URL url = new URL(urlString);

                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                URLConnection urlConnection = thenetHandle.openConnection(url, java.net.Proxy.NO_PROXY);
                if (urlConnection instanceof HttpURLConnection) {
                    httpURLConnection = (HttpURLConnection) urlConnection;

                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setDoOutput(true);

                    StringBuilder stringBuilder = new StringBuilder();

                    stringBuilder.append("username");
                    stringBuilder.append("=");
                    stringBuilder.append(username);

                    byte[] b = stringBuilder.toString().getBytes();
                    httpURLConnection.getOutputStream().write(b);

                    try {
                        httpURLConnection.connect();
                    } catch (IOException e) {}
                    outputStream.flush();

                    InputStream inputStream = null;
                    try {
                        inputStream = urlConnection.getInputStream();
                        byte[] cache = new byte[2 * 1024];
                        int len = inputStream.read(cache);
                        while (len != -1) {
                            outputStream.write(cache, 0, len);
                            len = inputStream.read(cache);
                        }
                    } catch (IOException e) {}
                    String result = "";
                    result = outputStream.toString();
                    if(result.startsWith("OK")){
                        String[] numbers = result.substring(3).split(",");
                        if(followfansread != null){
                            slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                                @Override
                                public void run() {
                                    followfansread[0].setText(numbers[0]);
                                    followfansread[1].setText(numbers[1]);
                                    followfansread[2].setText(numbers[2]);
                                }
                            });
                        }
                    }
                    else{
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                MyTools.toastShow("计数请求失败", slice.getContext());
                            }
                        });

                    }
                }
            } catch (IOException e) {}
            finally {
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
        });
    }
    /******************htt请求关注数目、粉丝数目、阅读数目数据区域***************>*/

    /*<****************http下载用户关注和粉丝列表据区域*****************/
    public static void DownDataFollowAndFanslistInfo(AbilitySlice slice,String username,String type){
        NetManager main_toplistnetmanger = NetManager.getInstance(slice.getContext());
        if (!main_toplistnetmanger.hasDefaultNet()) {
            return;
        }
        ThreadPoolUtil.submit(() -> {
            NetHandle thenetHandle = main_toplistnetmanger.getDefaultNet();
            NetStatusCallback netStatusCallback = new NetStatusCallback() {};
            HttpURLConnection httpURLConnection = null;
            String urlString = null;
            switch (type) {
                case "followlist":
                    urlString = DataCenterControl.serverIpWithPort + "followlist/?";
                    break;
                case "fanslist":
                    urlString = DataCenterControl.serverIpWithPort + "fanslist/?";
                    break;
                default:
                    urlString = DataCenterControl.serverIpWithPort + "inedx/?";
                    break;
            }

            try {
                URL url = new URL(urlString);

                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                URLConnection urlConnection = thenetHandle.openConnection(url, java.net.Proxy.NO_PROXY);
                if (urlConnection instanceof HttpURLConnection) {
                    httpURLConnection = (HttpURLConnection) urlConnection;

                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setDoOutput(true);

                    StringBuilder stringBuilder = new StringBuilder();

                    stringBuilder.append("username=");
                    stringBuilder.append(username);

                    byte[] b = stringBuilder.toString().getBytes();
                    httpURLConnection.getOutputStream().write(b);

                    try {
                        httpURLConnection.connect();
                    } catch (IOException e) {}
                    outputStream.flush();


                    InputStream inputStream = null;
                    try {
                        inputStream = urlConnection.getInputStream();
                        byte[] cache = new byte[2 * 1024];
                        int len = inputStream.read(cache);
                        while (len != -1) {
                            outputStream.write(cache, 0, len);
                            len = inputStream.read(cache);
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    String result = "";
                    result = outputStream.toString();

                    if(result.indexOf("sum") != -1){
                        //搜索成功
                        String finalResult = result;
                        switch (type){
                            case "followlist":
                                DataCenterControl.follow_listcontainer_list.clear();
                                ZSONObject zsonobject_follow = ZSONObject.stringToZSON(finalResult);
                                int sum_follow = Integer.parseInt(zsonobject_follow.getString("sum"));
                                for(int i = 0;i < sum_follow;i++){
                                    String info = zsonobject_follow.getString(String.valueOf(i));
                                    DataCenterControl.follow_listcontainer_list.add(new LCArryListNormalItem(info));
                                }
                                slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                                    @Override
                                    public void run() {
                                        if(DataCenterControl.followAndFanaListListContainerProvider != null){
                                            DataCenterControl.followAndFanaListListContainerProvider.notifyDataChanged();
                                        }
                                        MyTools.toastShow("关注列表下载成功！", slice.getContext());
                                    }
                                });
                                break;
                            case "fanslist":
                                DataCenterControl.fans_listcontainer_list.clear();
                                ZSONObject zsonobject_fans = ZSONObject.stringToZSON(finalResult);
                                int sum_fans = Integer.parseInt(zsonobject_fans.getString("sum"));
                                for(int i = 0;i < sum_fans;i++){
                                    String info = zsonobject_fans.getString(String.valueOf(i));
                                    DataCenterControl.fans_listcontainer_list.add(new LCArryListNormalItem(info));
                                }
                                slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                                    @Override
                                    public void run() {
                                        if(DataCenterControl.followAndFanaListListContainerProvider != null){
                                            DataCenterControl.followAndFanaListListContainerProvider.notifyDataChanged();
                                        }
                                        MyTools.toastShow("粉丝列表下载成功！", slice.getContext());
                                    }
                                });
                                break;
                            default:
                                break;
                        }
                    }
                    else{
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                MyTools.toastShow("好友为空！", slice.getContext());
                            }
                        });
                    }
                }
            } catch (IOException e) {}
            finally {
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
        });
    }
    /******************http下载用户关注和粉丝列表据区域***************>*/

    /*<****************http请求用户内容列表与收藏列表数据区域*****************/
    public static void DownDataUserContentListInfo(AbilitySlice slice,String type){
        NetManager main_toplistnetmanger = NetManager.getInstance(slice.getContext());
        if (!main_toplistnetmanger.hasDefaultNet()) {
            return;
        }
        ThreadPoolUtil.submit(() -> {
            NetHandle thenetHandle = main_toplistnetmanger.getDefaultNet();
            NetStatusCallback netStatusCallback = new NetStatusCallback() {};
            HttpURLConnection httpURLConnection = null;
            String urlString = DataCenterControl.serverIpWithPort + "usercontentlist/?";
            try {
                URL url = new URL(urlString);
                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                URLConnection urlConnection = thenetHandle.openConnection(url, java.net.Proxy.NO_PROXY);
                if (urlConnection instanceof HttpURLConnection) {
                    httpURLConnection = (HttpURLConnection) urlConnection;
                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setDoOutput(true);

                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append("username=");
                    stringBuilder.append(DataCenterControl.userName);
                    stringBuilder.append("&type=");
                    switch(type){
                        case "dtlist":
                            stringBuilder.append("dtlist");
                            break;
                        case "xmlist":
                            stringBuilder.append("xmlist");
                            break;
                        case "wzlist":
                            stringBuilder.append("wzlist");
                            break;
                        case "collectlist":
                            stringBuilder.append("collectlist");
                            break;
                        default:
                            break;
                    }
                    byte[] b = stringBuilder.toString().getBytes();
                    httpURLConnection.getOutputStream().write(b);

                    try {
                        httpURLConnection.connect();
                    } catch (IOException e) {}
                    outputStream.flush();


                    InputStream inputStream = null;
                    try {
                        inputStream = urlConnection.getInputStream();
                        byte[] cache = new byte[2 * 1024];
                        int len = inputStream.read(cache);
                        while (len != -1) {
                            outputStream.write(cache, 0, len);
                            len = inputStream.read(cache);
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    String result = "";
                    result = outputStream.toString();
                    if(result.indexOf("sum") != -1){
                        //请求全站动态成功
                        String finalResult = result;
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                switch (type) {
                                    case "dtlist":
                                        ZSONObject zsonobject_dt = ZSONObject.stringToZSON(finalResult);
                                        int sum_dt = Integer.parseInt(zsonobject_dt.getString("sum"));
                                        DataCenterControl.userdt_listcontainer_list.clear();
                                        for(int i = 0;i < sum_dt;i++){
                                            ZSONObject t = ZSONObject.stringToZSON(zsonobject_dt.getString(String.valueOf(i)));

                                            int detail_len = t.getString("DETAIL").length();
                                            DataCenterControl.userdt_listcontainer_list.add(
                                                    new LCArryListContentItem(t.getString("CONTENT_ID")
                                                            ,t.getString("TYPE")
                                                            ,t.getString("DATE")
                                                            ,t.getString("READVALUE")
                                                            ,t.getString("DETAIL").substring(12,detail_len - 1 - 1).replace("\\n","\n")
                                                            ,t.getString("USER_ID")
                                                            ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                    )
                                            );
                                        }
                                        if(DataCenterControl.userDtListContainerProvider != null){
                                            DataCenterControl.userDtListContainerProvider.notifyDataChanged();
                                        }
                                        MyTools.toastShow("用户动态下载成功！", slice.getContext());
                                        break;
                                    case "xmlist":
                                        ZSONObject zsonobject_xm = ZSONObject.stringToZSON(finalResult);
                                        int sum_xm = Integer.parseInt(zsonobject_xm.getString("sum"));
                                        DataCenterControl.userxm_listcontainer_list.clear();
                                        for(int i = 0;i < sum_xm;i++){
                                            ZSONObject t = ZSONObject.stringToZSON(zsonobject_xm.getString(String.valueOf(i)));

                                            int detail_len = t.getString("DETAIL").length();
                                            DataCenterControl.userxm_listcontainer_list.add(
                                                    new LCArryListContentItem(t.getString("CONTENT_ID")
                                                            ,t.getString("TYPE")
                                                            ,t.getString("DATE")
                                                            ,t.getString("READVALUE")
                                                            ,t.getString("DETAIL")
                                                            ,t.getString("USER_ID")
                                                            ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                    )
                                            );
                                        }
                                        if(DataCenterControl.userXmListContainerProvider != null){
                                            DataCenterControl.userXmListContainerProvider.notifyDataChanged();
                                        }
                                        MyTools.toastShow("用户项目下载成功！", slice.getContext());
                                        break;
                                    case "wzlist":
                                        ZSONObject zsonobject_wz = ZSONObject.stringToZSON(finalResult);
                                        int sum_wz = Integer.parseInt(zsonobject_wz.getString("sum"));
                                        DataCenterControl.userwz_listcontainer_list.clear();
                                        for(int i = 0;i < sum_wz;i++){
                                            ZSONObject t = ZSONObject.stringToZSON(zsonobject_wz.getString(String.valueOf(i)));

                                            int detail_len = t.getString("DETAIL").length();
                                            DataCenterControl.userwz_listcontainer_list.add(
                                                    new LCArryListContentItem(t.getString("CONTENT_ID")
                                                            ,t.getString("TYPE")
                                                            ,t.getString("DATE")
                                                            ,t.getString("READVALUE")
                                                            ,t.getString("DETAIL").substring(12,detail_len - 1 - 1).replace("\\n","\n")
                                                            ,t.getString("USER_ID")
                                                            ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                    )
                                            );
                                        }
                                        if(DataCenterControl.userWzListContainerProvider != null){
                                            DataCenterControl.userWzListContainerProvider.notifyDataChanged();
                                        }
                                        MyTools.toastShow("用户文章下载成功！", slice.getContext());
                                        break;
                                    case "collectlist":
                                        ZSONObject zsonobject_collect = ZSONObject.stringToZSON(finalResult);
                                        int sum_collect = Integer.parseInt(zsonobject_collect.getString("sum"));
                                        DataCenterControl.usercollect_listcontainer_list.clear();
                                        for(int i = 0;i < sum_collect;i++){
                                            ZSONObject t = ZSONObject.stringToZSON(zsonobject_collect.getString(String.valueOf(i)));
                                            String field = t.getString("TYPE");
                                            int detail_len = t.getString("DETAIL").length();
                                            if(field.equals("动态") || field.equals("文章")){
                                                DataCenterControl.usercollect_listcontainer_list.add(
                                                        new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                ,t.getString("TYPE")
                                                                ,t.getString("DATE")
                                                                ,t.getString("READVALUE")
                                                                ,t.getString("DETAIL").substring(12,detail_len - 1 - 1).replace("\\n","\n")
                                                                ,t.getString("USER_ID")
                                                                ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                        )
                                                );
                                            }
                                            if(field.equals("项目")){
                                                DataCenterControl.usercollect_listcontainer_list.add(
                                                        new LCArryListContentItem(t.getString("CONTENT_ID")
                                                                ,t.getString("TYPE")
                                                                ,t.getString("DATE")
                                                                ,t.getString("READVALUE")
                                                                ,t.getString("DETAIL")
                                                                ,t.getString("USER_ID")
                                                                ,DataCenterControl.fields[Integer.parseInt(t.getString("FIELD_ID")) - 1]
                                                        )
                                                );
                                            }
                                        }
                                        if(DataCenterControl.userCollectListContainerProvider != null){
                                            DataCenterControl.userCollectListContainerProvider.notifyDataChanged();
                                        }
                                        MyTools.toastShow("用户收藏下载成功！", slice.getContext());
                                        break;
                                    default:
                                        MyTools.toastShow("用户未知下载成功！", slice.getContext());
                                        break;
                                }
                            }
                        });
                    }
                    else if(result.equals("NULL")){
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                switch(type){
                                    case "dtlist":
                                        DataCenterControl.userdt_listcontainer_list.clear();
                                        if(DataCenterControl.userDtListContainerProvider != null){
                                            DataCenterControl.userDtListContainerProvider.notifyDataChanged();
                                        }
                                        break;
                                    case "xmlist":
                                        DataCenterControl.userxm_listcontainer_list.clear();
                                        if(DataCenterControl.userXmListContainerProvider != null){
                                            DataCenterControl.userXmListContainerProvider.notifyDataChanged();
                                        }
                                        break;
                                    case "wzlist":
                                        DataCenterControl.userwz_listcontainer_list.clear();
                                        if(DataCenterControl.userWzListContainerProvider != null){
                                            DataCenterControl.userWzListContainerProvider.notifyDataChanged();
                                        }
                                        break;
                                    case "collectlist":
                                        DataCenterControl.usercollect_listcontainer_list.clear();
                                        if(DataCenterControl.userCollectListContainerProvider != null){
                                            DataCenterControl.userCollectListContainerProvider.notifyDataChanged();
                                        }
                                        break;
                                }
                                MyTools.toastShow("用户内容为空！", slice.getContext());
                            }
                        });
                    }
                    else{
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                switch (type) {
                                    case "dtlist":
                                        MyTools.toastShow("用户动态下载失败！", slice.getContext());
                                        break;
                                    case "xmlist":
                                        MyTools.toastShow("用户项目下载失败！", slice.getContext());
                                        break;
                                    case "wzlist":
                                        MyTools.toastShow("用户文章下载失败！", slice.getContext());
                                        break;
                                    case "collectlist":
                                        MyTools.toastShow("用户收藏下载失败！", slice.getContext());
                                        break;
                                    default:
                                        MyTools.toastShow("用户未知下载失败！", slice.getContext());
                                        break;
                                }
                            }
                        });
                    }
                }
            } catch (IOException e) {
            } finally {
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
        });
    }
    /******************http请求用户内容列表与收藏列表数据区域***************>*/

    /*<****************http删除用户内容数据区域*****************/
    public static void UpDataDeleteUserContentInfo(AbilitySlice slice,String type, String contentid, ArrayList<LCArryListContentItem> list, LCProviderForContent lcProviderForContent, int list_i){
        NetManager main_toplistnetmanger = NetManager.getInstance(slice.getContext());
        if (!main_toplistnetmanger.hasDefaultNet()) {
            return;
        }
        ThreadPoolUtil.submit(() -> {
            NetHandle thenetHandle = main_toplistnetmanger.getDefaultNet();
            NetStatusCallback netStatusCallback = new NetStatusCallback() {};
            HttpURLConnection httpURLConnection = null;
            String urlString = DataCenterControl.serverIpWithPort + "deleteusercontent/?";

            try {
                URL url = new URL(urlString);
                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                URLConnection urlConnection = thenetHandle.openConnection(url, java.net.Proxy.NO_PROXY);
                if (urlConnection instanceof HttpURLConnection) {
                    httpURLConnection = (HttpURLConnection) urlConnection;
                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setDoOutput(true);

                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append("username=");
                    stringBuilder.append(DataCenterControl.userName);
                    stringBuilder.append("&contentid=");
                    stringBuilder.append(contentid);

                    byte[] b = stringBuilder.toString().getBytes();
                    httpURLConnection.getOutputStream().write(b);

                    try {
                        httpURLConnection.connect();
                    } catch (IOException e) {}
                    outputStream.flush();

                    InputStream inputStream = null;
                    try {
                        inputStream = urlConnection.getInputStream();
                        byte[] cache = new byte[2 * 1024];
                        int len = inputStream.read(cache);
                        while (len != -1) {
                            outputStream.write(cache, 0, len);
                            len = inputStream.read(cache);
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    String result = "";
                    result = outputStream.toString();

                    if(result.equals("OK")){
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                list.remove(list_i);
                                lcProviderForContent.notifyDataChanged();
                                MyTools.toastShow("删除成功！", slice.getContext());
                            }
                        });
                    }
                    else if(result.equals("NO")){
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                MyTools.toastShow("删除失败！刷可刷新加载！", slice.getContext());
                            }
                        });
                    }
                }
            } catch (IOException e) {}
            finally {
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
        });
    }
    /******************http删除用户内容数据区域***************>*/

    /*<****************http发送点击阅读指令区域*****************/
    public static void UpDataWorldListReadInfo(AbilitySlice slice,String content_id,String user_id,Button detail_authorbut,Button detail_topddl_agreebut,Button detail_topddl_collectbut){
        NetManager main_toplistnetmanger = NetManager.getInstance(slice.getContext());
        if (!main_toplistnetmanger.hasDefaultNet()) {return;}
        ThreadPoolUtil.submit(() -> {
            NetHandle thenetHandle = main_toplistnetmanger.getDefaultNet();
            NetStatusCallback netStatusCallback = new NetStatusCallback() {};
            HttpURLConnection httpURLConnection = null;

            String urlString = DataCenterControl.serverIpWithPort + "read/?";

            try {
                URL url = new URL(urlString);
                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                URLConnection urlConnection = thenetHandle.openConnection(url, java.net.Proxy.NO_PROXY);
                if (urlConnection instanceof HttpURLConnection) {
                    httpURLConnection = (HttpURLConnection) urlConnection;
                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setDoOutput(true);

                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append("username=");
                    stringBuilder.append(DataCenterControl.userName);
                    stringBuilder.append("&content_id=");
                    stringBuilder.append(content_id);
                    stringBuilder.append("&user_id=");
                    stringBuilder.append(user_id);

                    byte[] b = stringBuilder.toString().getBytes();
                    httpURLConnection.getOutputStream().write(b);
                    try {
                        httpURLConnection.connect();
                    } catch (IOException e) {}
                    outputStream.flush();

                    InputStream inputStream = null;
                    try {
                        inputStream = urlConnection.getInputStream();
                        byte[] cache = new byte[2 * 1024];
                        int len = inputStream.read(cache);
                        while (len != -1) {
                            outputStream.write(cache, 0, len);
                            len = inputStream.read(cache);
                        }
                    } catch (IOException e) {}
                    String result = "";
                    result = outputStream.toString();

                    String[] tosettext = {"","",""};
                    if(result.startsWith("ok:")){
                        result = result.substring(3);
                        if(result.charAt(0) == '0'){
                            tosettext[0] = "关注";
                        }
                        else{
                            tosettext[0] = "已关注";
                        }
                        if(result.charAt(1) == '0'){
                            tosettext[1] = "点赞";
                        }
                        else{
                            tosettext[1] = "已点赞";
                        }
                        if(result.charAt(2) == '0'){
                            tosettext[2] = "收藏";
                        }
                        else{
                            tosettext[2] = "已收藏";
                        }

                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                detail_authorbut.setText(tosettext[0]);
                                detail_topddl_agreebut.setText(tosettext[1]);
                                detail_topddl_collectbut.setText(tosettext[2]);
                            }
                        });
                    }
                }
            } catch (IOException e) {} finally {
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
        });
    }
    /******************http发送点击阅读指令区域***************>*/

    /*<****************http请求内容评论数据区域*****************/
    public static void DownDataContentDiscussListInfo(AbilitySlice slice, String contentid){
        NetManager main_toplistnetmanger = NetManager.getInstance(slice.getContext());
        if (!main_toplistnetmanger.hasDefaultNet()) {
            return;
        }
        ThreadPoolUtil.submit(() -> {
            NetHandle thenetHandle = main_toplistnetmanger.getDefaultNet();
            NetStatusCallback netStatusCallback = new NetStatusCallback() {};
            HttpURLConnection httpURLConnection = null;

            String urlString = DataCenterControl.serverIpWithPort + "pulldiscuss/?";
            try {
                URL url = new URL(urlString);
                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                URLConnection urlConnection = thenetHandle.openConnection(url, java.net.Proxy.NO_PROXY);
                if (urlConnection instanceof HttpURLConnection) {
                    httpURLConnection = (HttpURLConnection) urlConnection;
                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setDoOutput(true);

                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append("contentid=");
                    stringBuilder.append(contentid);

                    byte[] b = stringBuilder.toString().getBytes();
                    httpURLConnection.getOutputStream().write(b);

                    try {
                        httpURLConnection.connect();
                    } catch (IOException e) {}
                    outputStream.flush();

                    InputStream inputStream = null;
                    try {
                        inputStream = urlConnection.getInputStream();
                        byte[] cache = new byte[2 * 1024];
                        int len = inputStream.read(cache);
                        while (len != -1) {
                            outputStream.write(cache, 0, len);
                            len = inputStream.read(cache);
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    String result = "";
                    result = outputStream.toString();
                    if(result.indexOf("sum") != -1){
                        String finalResult = result;
                        ZSONObject zsonobject_dt = ZSONObject.stringToZSON(finalResult);
                        int sum_dt = Integer.parseInt(zsonobject_dt.getString("sum"));
                        DataCenterControl.discuss_listcontainer_list.clear();
                        for(int i = 0;i < sum_dt;i++){
                            ZSONObject t = ZSONObject.stringToZSON(zsonobject_dt.getString(String.valueOf(i)));
                            DataCenterControl.discuss_listcontainer_list.add(new LCArryListNormalItem(t.getString("detail")));
                        }
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                if(DataCenterControl.discussListContainerProvider != null){
                                    DataCenterControl.discussListContainerProvider.notifyDataChanged();
                                }
                                MyTools.toastShow("内容评论下载成功！", slice.getContext());
                            }
                        });
                    }
                    else if(result.equals("NULL")){
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                DataCenterControl.discuss_listcontainer_list.clear();
                                if(DataCenterControl.discussListContainerProvider != null){
                                    DataCenterControl.discussListContainerProvider.notifyDataChanged();
                                }
                                MyTools.toastShow("评论为空！", slice.getContext());
                            }
                        });
                    }
                    else{
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                MyTools.toastShow("该内容评论下载失败！", slice.getContext());
                            }
                        });
                    }
                }
            } catch (IOException e) {}
            finally {
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
        });
    }
    /******************http请求内容评论数据区域***************>*/

    /*<****************http发布评论数据区域*****************/
    public static void UpDataContentDiscussInfo(AbilitySlice slice,String contentid,String detail,TextField discuss_writetfd){
        NetManager main_toplistnetmanger = NetManager.getInstance(slice.getContext());
        if (!main_toplistnetmanger.hasDefaultNet()) {
            return;
        }
        ThreadPoolUtil.submit(() -> {
            NetHandle thenetHandle = main_toplistnetmanger.getDefaultNet();
            NetStatusCallback netStatusCallback = new NetStatusCallback() {};
            HttpURLConnection httpURLConnection = null;

            String urlString = DataCenterControl.serverIpWithPort + "pushdiscuss/?";
            try {
                URL url = new URL(urlString);
                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                URLConnection urlConnection = thenetHandle.openConnection(url, java.net.Proxy.NO_PROXY);
                if (urlConnection instanceof HttpURLConnection) {
                    httpURLConnection = (HttpURLConnection) urlConnection;
                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setDoOutput(true);

                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append("username=");
                    stringBuilder.append(DataCenterControl.userName);
                    stringBuilder.append("&contentid=");
                    stringBuilder.append(contentid);
                    stringBuilder.append("&detail=");
                    stringBuilder.append(detail);
                    stringBuilder.append("&time=");
                    SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    Date date = new Date(System.currentTimeMillis());
                    stringBuilder.append(formatter.format(date));

                    byte[] b = stringBuilder.toString().getBytes();
                    httpURLConnection.getOutputStream().write(b);

                    try {
                        httpURLConnection.connect();
                    } catch (IOException e) {}
                    outputStream.flush();


                    InputStream inputStream = null;
                    try {
                        inputStream = urlConnection.getInputStream();
                        byte[] cache = new byte[2 * 1024];
                        int len = inputStream.read(cache);
                        while (len != -1) {
                            outputStream.write(cache, 0, len);
                            len = inputStream.read(cache);
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    String result = "";
                    result = outputStream.toString();
                    if(result.equals("OK")){
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                discuss_writetfd.clearFocus();
                                discuss_writetfd.setText("");
                                MyTools.toastShow("评论成功！", slice.getContext());
                            }
                        });
                    }
                    else if(result.equals("NO")){
                        slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                            @Override
                            public void run() {
                                MyTools.toastShow("评论失败！！", slice.getContext());
                            }
                        });
                    }
                }
            } catch (IOException e) {
            } finally {
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
        });
    }
    /******************http发布评论数据区域***************>*/

    /*<****************http发送点赞或收藏指令区域*****************/
    public static void UpDataAgreeAndCollectInfo(AbilitySlice slice,String content_id,String operation,Button button){
        NetManager main_toplistnetmanger = NetManager.getInstance(slice.getContext());
        if (!main_toplistnetmanger.hasDefaultNet()) {
            return;
        }
        ThreadPoolUtil.submit(() -> {
            NetHandle thenetHandle = main_toplistnetmanger.getDefaultNet();
            NetStatusCallback netStatusCallback = new NetStatusCallback() {};
            HttpURLConnection httpURLConnection = null;
            String urlString = "";
            if(operation.equals("点赞")){
                urlString = DataCenterControl.serverIpWithPort + "agree/?";
            }
            if(operation.equals("收藏")){
                urlString = DataCenterControl.serverIpWithPort + "collect/?";
            }
            if(operation.equals("取消点赞")){
                urlString = DataCenterControl.serverIpWithPort + "unagree/?";
            }
            if(operation.equals("取消收藏")){
                urlString = DataCenterControl.serverIpWithPort + "uncollect/?";
            }

            try {
                URL url = new URL(urlString);
                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                URLConnection urlConnection = thenetHandle.openConnection(url, java.net.Proxy.NO_PROXY);
                if (urlConnection instanceof HttpURLConnection) {
                    httpURLConnection = (HttpURLConnection) urlConnection;
                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setDoOutput(true);

                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append("username=");
                    stringBuilder.append(DataCenterControl.userName);
                    stringBuilder.append("&contentid=");
                    stringBuilder.append(content_id);
                    stringBuilder.append("&time=");
                    SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    Date date = new Date(System.currentTimeMillis());
                    stringBuilder.append(formatter.format(date));

                    byte[] b = stringBuilder.toString().getBytes();
                    httpURLConnection.getOutputStream().write(b);
                    try {
                        httpURLConnection.connect();
                    } catch (IOException e) {}
                    outputStream.flush();

                    InputStream inputStream = null;
                    try {
                        inputStream = urlConnection.getInputStream();
                        byte[] cache = new byte[2 * 1024];
                        int len = inputStream.read(cache);
                        while (len != -1) {
                            outputStream.write(cache, 0, len);
                            len = inputStream.read(cache);
                        }
                    } catch (IOException e) {}
                    String result = "";
                    result = outputStream.toString();

                    String[] tosettext = {"","",""};
                    if(result.equals("OK")){
                        if(operation.equals("点赞")){
                            slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                                @Override
                                public void run() {
                                    button.setText("已点赞");
                                }
                            });
                        }
                        if(operation.equals("收藏")){
                            slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                                @Override
                                public void run() {
                                    button.setText("已收藏");
                                }
                            });
                        }
                        if(operation.equals("取消点赞")){
                            slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                                @Override
                                public void run() {
                                    button.setText("点赞");
                                }
                            });
                        }
                        if(operation.equals("取消收藏")){
                            slice.getUITaskDispatcher().asyncDispatch(new Runnable() {
                                @Override
                                public void run() {
                                    button.setText("收藏");
                                }
                            });

                        }
                    }
                }
            } catch (IOException e) {}
            finally {
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
        });
    }
    /******************http发送点赞或收藏指令区域***************>*/

    public static void toastShow(String info, Context context){
        ToastDialog toastDialog = new ToastDialog(context);
        toastDialog.setText(info);

        toastDialog.setTransparent(true);
        toastDialog.setDuration(50);
        toastDialog.setAlignment(LayoutAlignment.CENTER);
        toastDialog.show();
    }
    public static void commonDialogRemoveShow(String title, String content, Component component,int itemid, AbilitySlice slice,String operation){
        CommonDialog commonDialog = new CommonDialog(slice.getContext());
        commonDialog.setTitleText(title);
        commonDialog.setContentText(content);
        commonDialog.setSize(630,400);
        commonDialog.setButton(1, "确认", new IDialog.ClickedListener() {
            @Override
            public void onClick(IDialog iDialog, int i) {
                if(operation.equals("destory")){
                    MyTools.UpDataDestoryInfo(slice,DataCenterControl.userName);
                }
                if(operation.equals("follow")){
                    Text text = (Text) ((DirectionalLayout)component).getComponentAt(0);
                    String s = text.getText();
                    if(s.substring(0,s.length() - 4).equals(DataCenterControl.userName)){
                        MyTools.toastShow("无法关注自己！",slice.getContext());
                        commonDialog.destroy();
                        return;
                    }
                    MyTools.UpDataFollowInfo(slice,component,s.substring(0,s.length() - 4),itemid,"关注");
                }
                if(operation.equals("unfollow")){
                    Text text = (Text) ((DirectionalLayout)component).getComponentAt(0);
                    String s = text.getText();
                    MyTools.UpDataFollowInfo(slice,component,s.substring(0,s.length() - 5),itemid,"取消关注");
                }
                commonDialog.destroy();
            }
        });
        commonDialog.setButton(2, "取消", new IDialog.ClickedListener() {
            @Override
            public void onClick(IDialog iDialog, int i) {
                commonDialog.destroy();
            }
        });
        commonDialog.show();
    }
    public static void selectImage(AbilitySlice abilitySlice, int requestCode){
        Intent intent = new Intent();
        Operation operation = new Intent.OperationBuilder()
                .withAction("android.intent.action.GET_CONTENT")
                .withFlags(Intent.FLAG_NOT_OHOS_COMPONENT)
                .build();
        intent.setOperation(operation);
        intent.setType("image/*");
        abilitySlice.startAbilityForResult(intent,requestCode);
    }

}
